// package: rewords-server-2024
// filename: admin
// author: diogoxiang@gmail.com
// time: 2024/11/8 16:34

package admin

import (
	"context"
	"rewords-server-2024/internal/library/contexts"
	"rewords-server-2024/internal/model/entity"

	"rewords-server-2024/api/admin"
)

var (
	OpenUser = cOpenUser{}
)

type cOpenUser struct{}

func (c *cOpenUser) Login(ctx context.Context, req *admin.LoginReq) (res *admin.LoginRes, err error) {

	return &admin.LoginRes{
		Token: "eyJ2ZXJzaW9uIjoiMSJ9.ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SlZTVVFpT2pFc0ltVjRjQ0k2TVRjek1UQTFOalUxTkN3aWJtSm1Jam94TnpNd05EVXhOelUwTENKcFlYUWlPakUzTXpBME5URTNOVFI5Li1jNWVpVlhFXzJDZzJXUXB0Um52Y1RRZ3ZnRUFFRmc4WHduSzVmTHZVaFU",
		SysAdminUser: entity.SysAdminUser{
			Uid:      1,
			Username: "admin",
			Role:     "admin",
			Status:   1,
			Avatar:   "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
			Phone:    "1234567890",
		},
	}, nil
}

func (c *cOpenUser) Info(ctx context.Context, req *admin.UserInfoReq) (res *admin.UserInfoRes, err error) {

	uid := contexts.GetUserId(ctx)

	return &admin.UserInfoRes{
		SysAdminUser: entity.SysAdminUser{
			Uid:      uid,
			Username: "admin",
			Role:     "admin",
			Status:   1,
			Avatar:   "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
			Phone:    "1234567890",
		},
	}, nil
}
